/**
 * Created by zlj on 2016/12/6.
 */
require('jquery')
require('layout/util');
var $form = require('js-path/formValide.js');
var $alert = require('libs/alert');
$(function () {
    $('#channel_back').on('click',function () {
        window.history.go(-1);
    });
    $('#back').on('click',function () {
        window.history.go(-1);
    });
    judge();

});

//judge判断新增或更新
function judge() {
    var url =window.location.href;
    if(url.indexOf("id=")>0){
        var id = $.getUrlParam('id');
        load(id);
    }
}

//load
function load(id) {
    $.ajax({
        url:'api/v1/p/mms/domesticLogisticsProvider/detail',
        type:'post',
        data:{
            id:id
        },
        dataType:'json',
        success:function (result) {
            if (result.code == 200){
                $('#logistics_form').setForm(result.data);
            }else{
                $alert(result.message);
            }
        },
        error:function (e) {
            console.error('api/v1/p/mms/domesticLogisticsProvider/detail 接口调用失败 ' )
        }
    })
}
